package cn.wubo.base.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@MappedSuperclass
@Data
@EntityListeners(AuditingEntityListener.class)//监听实体属性变化
public class Base {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "createtime")
    @CreatedDate
    private Date createTime;
    @Column(name = "createby")
    @CreatedBy
    private Long createBy;

    @Column(name = "modifiedtime")
    @LastModifiedDate
    private Date modifiedTime;
    @Column(name = "modifiedby")
    @LastModifiedBy
    private Long modifiedBy;
}
